package com.bootcamp.mvc1125.controller;

import com.bootcamp.mvc1125.bean.BaseRespVO;
import com.bootcamp.mvc1125.bean.User;
import com.bootcamp.mvc1125.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: spring-1125-mvc-java-config
 * @description:
 * @author: Keyu Li
 * @create: 2021-11-25 11:36
 **/


@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping("query/{id}")
    public BaseRespVO queryById(@PathVariable("id") Integer id){
        User user = userService.queryById(id);
        return BaseRespVO.ok(user);
    }

}
